package com.example.demospringmybatisplus.listener;

import com.example.demospringmybatisplus.entity.Invoice;
import com.example.demospringmybatisplus.enums.InvoiceActionEnum;
import com.example.demospringmybatisplus.service.NotificationService;

/**
 * 处理新增收款操作的通知
 *
 * @author huahua
 * @DATE 2025/8/2
 **/
public class InvoiceAddRetrieveActionListener implements InvoiceActionListener {
    private NotificationService notificationService;

    public InvoiceAddRetrieveActionListener(NotificationService notificationService) {
        this.notificationService = notificationService;
    }

    @Override
    public void notify(InvoiceActionEnum invoiceAction, Invoice current, Invoice... before) {
        if (invoiceAction == InvoiceActionEnum.ADD_RETRIEVE) {
            // 执行新增收款操作相关业务逻辑
            System.out.println("执行新增收款操作相关业务逻辑......");
            notificationService.addRetrieveActionNotification(current);
        }
    }
}
